package com.zyddd.common;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@ResponseBody
@ControllerAdvice(annotations = RestController.class)
public class GlobalExceptionHandle {
    @ExceptionHandler/*拦截所有异常*/
    public R<String> exceptionHandle(Exception e){
        e.printStackTrace();
        return R.error("system error");
    }
}
